package org.eyeTopLight.po;

import lombok.Data;
import org.eyeTopLight.constant.ConstantUtil;
import org.eyeTopLight.po.initEntity.Goods;

import java.text.SimpleDateFormat;
import java.util.Date;

@Data
public class FrameGoods implements Goods {
    private Integer frameGoods_id;
    private Date frameGoods_updateDate;
    private String frameGoods_name;
    private String frameGoods_desc;
    private String frameGoods_category;
    private String frameGoods_imageUrl;
    private String frameGoods_price;
    private String frameGoods_store;
    private String frameGoods_onShelf;
    private Integer frameGoods_imageCount;
    private Integer frameGoods_salesMonth;
    private Integer frameGoods_salesAll;
    private String frameGoods_detailsImageUrl;
    private Integer frameGoods_detailsImageCount;

    @Override
    public String getImageUrlAtIndex(Integer index){
        String[] imageUrls = frameGoods_imageUrl.split(ConstantUtil.SEPARATOR_SYMBOL);
        if(imageUrls == null || index >= imageUrls.length){
            return null;
        }
        return imageUrls[index];
    }

    @Override
    public String getSymbol() {
        return "frame";
    }

    @Override
    public String getGoods_updateDate() {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
        String dateTime = formatter.format(getFrameGoods_updateDate());
        return dateTime;
    }

    @Override
    public String getGoods_imageUrl() {
        return getFrameGoods_imageUrl();
    }

}
